﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HA.ModFlow.Domain.FileLayer;

namespace HA.ModFlow.Domain.DomainLayer
{


    [Serializable]
   public class SIPSolver:MFSolver,ICloneable
    {
        int _MAXITER=50;

        /// <summary>
        /// 为尝试解决有限差分方程在一个时间步长最大的迭代次数
        /// </summary>
        public int MAXITER
        {
            get { return _MAXITER; }
            set { _MAXITER = value; }
        }

        int _NPARM=5;

        /// <summary>
        /// 迭代变量使用的数量，5个一般就足够了
        /// </summary>
        public int NPARM
        {
            get { return _NPARM; }
            set { _NPARM = value; }
        }

        double _ACCL=1;

        /// <summary>
        /// 加速变量，一般来说大约0，且一般等于1，如果输入0，那么按1处理。
        /// </summary>
        public double ACCL
        {
            get { return _ACCL; }
            set { _ACCL = value; }
        }

        double _HCLOSE=0.001;

        /// <summary>
        /// 水头变化收敛准则，
        /// </summary>
        public double HCLOSE
        {
            get { return _HCLOSE; }
            set { _HCLOSE = value; }
        }


       

        bool _IPCALC=false;
        /// <summary>
        /// 计算迭代变量的seed的来源,0 为用户输入 1 为内部计算
        /// </summary>
        public bool IPCALCUserSpecifed
        {
            get { return _IPCALC; }
            set { _IPCALC = value; }
        }

        double _WSEED=0;

        /// <summary>
        /// 计算迭代变量的seed
        /// </summary>
        public double WSEED
        {
            get { return _WSEED; }
            set { _WSEED = value; }
        }

        int _IPRSIP=0;

        /// <summary>
        /// Sip的输出间隔。如果等于0，则按999处理。
        /// </summary>
        public int IPRSIP
        {
            get { return _IPRSIP; }
            set { _IPRSIP = value; }
        }


        

        public PStronglyImplicitProcedure ToSipPack()
        {
            PStronglyImplicitProcedure sip = new PStronglyImplicitProcedure();

            sip.MAXITER = this.MAXITER;
            sip.NPARM = this.NPARM;
            sip.ACCL = this.ACCL;
            sip.HCLOSE = this.HCLOSE;

            if (this._IPCALC)
            {
                sip.IPCALC = 0;  
            }
            else
            {
                sip.IPCALC = 1;                
            }

            sip.WSEED = this.WSEED;
            sip.IPRSIP = this.IPRSIP;
            return sip;
 
        }


        public object Clone()
        {
            return this.MemberwiseClone();
        }
    }
}
